/**
 * 
 */
package com.example.gensurdatviwi.application.datamodel;

import java.io.Serializable;

import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;

/**
 * @author Michael Hausegger
 *
 */
public class SurveyDatabaseField implements Serializable {
	
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 3241493513601428617L;


	
	Long       id;
	
	
	String     name;
	
	String     iconName;
	
	String     toolTipText;
	
	Class<?>   className;	
	

	
	
	/**
	 * @param id
	 * @param name
	 * @param iconName
	 * @param toolTipText
	 * @param className
	 */
	public SurveyDatabaseField(Long id, String name, String iconName,
			String toolTipText, Class<?> className) {
		
		super();
		this.id = id;
		this.name = name;
		this.iconName = iconName;
		this.toolTipText = toolTipText;
		this.className = className;
		
	}	
	
	
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the iconName
	 */
	public String getIconName() {
		return iconName;
	}

	/**
	 * @param iconName the iconName to set
	 */
	public void setIconName(String iconName) {
		this.iconName = iconName;
	}

	/**
	 * @return the toolTipText
	 */
	public String getToolTipText() {
		return toolTipText;
	}

	/**
	 * @param toolTipText the toolTipText to set
	 */
	public void setToolTipText(String toolTipText) {
		this.toolTipText = toolTipText;
	}

	/**
	 * @return the className
	 */
	public Class<?> getClassName() {
		return className;
	}

	/**
	 * @param className the className to set
	 */
	public void setClassName(Class<?> className) {
		this.className = className;
	}


	/**
	 * Zu tun.
	 * 
	 * @return
	 */
	public Component getAsComponent(){
		
		Embedded e = new Embedded(this.name,
	                 new ThemeResource("../gensurdatviwi_theme/icons/" + this.iconName));
		
	        e.setAlternateText(this.toolTipText);
	        
	        e.setHeight("60px");
	        
	        e.setWidth("60px");
	        
	        
	        //Needed so that we can identify in the controller which item was chosen.
	        e.setDebugId(this.id.toString());

	        
	        return e;
	        
	}
	
	
}
